package com.yuandian.customer.perception.controller;

import com.yuandian.api.customer_perception.po.TopBaseParams;
import com.yuandian.api.customer_perception.vo.AvgTakeTimeTopNVo;
import com.yuandian.api.customer_perception.vo.TopAnalysisOverviewVo;
import com.yuandian.bpm.common.core.util.R;
import com.yuandian.customer.perception.service.IBusiTopAnalysisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 类说明: 全业务TOP 分析服务
 *
 * @Date 2021/8/19 9:24
 * @Author User
 */
@Api(value = "TOP 分析接口", tags = "TOP 分析接口")
@RestController
@RequestMapping(value = "/top/busi")
public class BusiTopAnalysisController {

    @Resource
    private IBusiTopAnalysisService busiTopAnalysisService;

    /**
     * 查询全业务TOP 分析总览
     *
     * @param params 请求参数
     * @return 通用返回对象
     */
    @PostMapping(value = "/overview")
    @ApiOperation(value = "TOP 分析-查询全业务TOP 分析总览", notes = "TOP 分析-查询全业务TOP 分析总览")
    public R<TopAnalysisOverviewVo> queryOverview (@RequestBody TopBaseParams params) {
        TopAnalysisOverviewVo topAnalysisOverviewVo = busiTopAnalysisService.queryTopAnalysisOverview(params);
        return R.ok(topAnalysisOverviewVo);
    }


    /**
     * 查询全业务受理量TOPN
     *
     * @param params 请求参数
     * @return 通用返回对象
     */
    @ApiOperation(value = "TOP 分析-查询全业务受理量TOPN", notes = "TOP 分析-查询全业务受理量TOPN")
    @PostMapping(value = "/complete/topN")
    public R<List<TopAnalysisOverviewVo>> queryCompleteTopN (@RequestBody TopBaseParams params) {
        List<TopAnalysisOverviewVo> topAnalysisOverviewVos = busiTopAnalysisService.queryCompleteTopN(params);
        return R.ok(topAnalysisOverviewVos);
    }


    /**
     * 查询全业务失败量topN
     *
     * @param params 请求参数
     * @return 通用返回对象
     */
    @PostMapping(value = "/fail/topN")
    @ApiOperation(value = "TOP 分析-查询全业务失败量topN", notes = "TOP 分析-查询全业务失败量topN")
    public R<List<TopAnalysisOverviewVo>> queryFailTopN (@RequestBody TopBaseParams params) {
        List<TopAnalysisOverviewVo> topAnalysisOverviewVos = busiTopAnalysisService.queryFailTopN(params);
        return R.ok(topAnalysisOverviewVos);
    }


    /**
     * 查询全业务人工操作平均耗时topN
     *
     * @param params 请求参数
     * @return 通用返回对象
     */
    @PostMapping(value = "/queryAvgVisitTimeTopN")
    @ApiOperation(value = "TOP 分析-查询全业务人工操作平均耗时topN", notes = "TOP 分析-查询全业务人工操作平均耗时topN")
    public R<AvgTakeTimeTopNVo> queryAvgVisitTimeTopN (@RequestBody TopBaseParams params) {
        AvgTakeTimeTopNVo avgTakeTimeTopNVo = busiTopAnalysisService.queryAvgVisitTimeTopN(params);
        return R.ok(avgTakeTimeTopNVo);
    }


    /**
     * 查询全业务响应平均耗时topN
     *
     * @param params 请求参数
     * @return 通用返回对象
     */
    @PostMapping(value = "/queryAvgDealTimeTopN")
    @ApiOperation(value = "TOP 分析-查询全业务响应平均耗时topN", notes = "TOP 分析-查询全业务响应平均耗时topN")
    public R<AvgTakeTimeTopNVo> queryAvgDealTimeTopN (@RequestBody TopBaseParams params) {
        AvgTakeTimeTopNVo avgTakeTimeTopNVo = busiTopAnalysisService.queryAvgDealTimeTopN(params);
        return R.ok(avgTakeTimeTopNVo);
    }
}
